#ifndef QWNDACTION_H
#define QWNDACTION_H

#include <QAction>
#include <windows.h>

class QWndAction : public QAction
{
	Q_OBJECT
public:
	explicit QWndAction(QObject* parent) :
			QAction(parent){}
	QWndAction(const QString &text, QObject* parent) :
			QAction(text, parent){}
	QWndAction(const QIcon &icon, const QString &text, QObject* parent) :
			QAction(icon, text, parent){}

	HWND hwnd()	{return hWnd;}
	void setHwnd(const HWND hw) { hWnd = hw; }
public slots:
	void setWndVisible(bool bVisible)
	{
		if (!::IsWindow(hWnd))
			return;

		::ShowWindow(hWnd, bVisible ?
			 SW_SHOW : SW_HIDE);
	}
private:
	HWND hWnd;
};

#endif // QWNDACTION_H
